﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.IO;


namespace LevSTProgramTransform
{
    class SettingRead
    {
        string ConfigFileName = string.Empty;

        XDocument Xdoc;

        public SettingRead(string configFileName)
        {
            ConfigFileName = configFileName;
            if (!(File.Exists(configFileName)))
            {
                Console.WriteLine("Config File Missing... ");
                Console.WriteLine("Default Config File Creating... ");
                //Xdoc = CreateDefaultXMLConfigFile(ConfigFileName);
                return;
            }
            //Xdoc = CreateDefaultXMLConfigFile(ConfigFileName);

#if DEBUG
            Console.WriteLine("Reading Config File... ");
#endif
            try
            {
                Xdoc = XDocument.Load(ConfigFileName);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return;
            }
#if DEBUG
            Console.WriteLine(Xdoc);
#endif
        }

    }
}
